Detecting failure of layer 2 service using broadcast messages

ABSTRACT

Some embodiments provide a method for detecting a failure of a layer 2 (L2) bump-in-the-wire service at a device. In some embodiments, the device sends heartbeat signals to a second device connected to L2 service nodes in order to detect failure of the L2 service (e.g., a failure of all the service nodes). In some embodiments, the heartbeat signals are unidirectional heartbeat signals (e.g., a unidirectional bidirectional-forwarding-detection (BFD) session) sent from each device to the other. The heartbeat signals, in some embodiments, use a broadcast MAC address in order to reach the current active L2 service node in the case of a failover (i.e., an active service node failing and a standby service node becoming the new active service node). The unidirectional heartbeat signals are also used, in some embodiments, to decrease the time between a failover and data messages being forwarded to the new active service node.

BACKGROUND

In a software defined network, a set of gateway devices (e.g., Edge Nodes) connecting the internal virtualized network and an external network may have a layer 2 bump in the wire service (i.e., a service that does not change the layer 2 addresses of a processed data message) inserted in the processing pipeline. Failure of the layer 2 service is difficult to detect in some instances. When a backup layer 2 service node is provided and a primary layer 2 service node fails, the gateway device must begin sending the data messages to the backup layer 2 service node. A method for learning of the failure and quickly redirecting data messages to the backup layer 2 service node is necessary.

BRIEF SUMMARY

Some embodiments provide a method for providing a layer 2 (L2) bump-in-the-wire service at a gateway device (e.g., a layer 3 (L3) gateway device) at the edge of a logical network. The method, in some embodiments, establishes a connection from a first interface of the gateway device to a service node that provides the L2 service. The method also establishes a connection from a second interface of the gateway device to the L2 service node. The method then sends data messages received by the gateway device that require the L2 service to the service node using the first interface. In some embodiments, north-to-south traffic (i.e., from the external network to the logical network) is sent to the service node using the first interface while the south-to-north traffic is sent to the service node using the second interface.

Some embodiments provide a method for applying different policies at the service node for different tenants of a datacenter. Data messages received for a particular tenant that require the L2 service are encapsulated or marked as belonging to the tenant before being sent to the service node. Based on the encapsulation or marking, the service node provides the service according to policies defined for the tenant.

The first and second interfaces of the gateway devices have different internet protocol (IP) addresses and media access control (MAC) addresses in some embodiments. The IP addresses, in some embodiments, are not used to communicate with devices of external networks and can have internal IP addresses used within the logical network. The next hop MAC address for a data message requiring the L2 service sent from the first interface will be the MAC address of the second interface and will arrive at the second interface with the destination MAC address unchanged by the service node. In some embodiments, interfaces for connecting to the L2 service are disabled on standby gateway devices of the logical network and are enabled on only an active gateway device.

Connections to the service node, in some embodiments, are made through layer 2 switches. In some embodiments, each interface connects to a different switch connected to the service node. The service node, in some embodiments, is a cluster of service nodes in an active-standby configuration that each connect to the same pair of switches. In some embodiments of an active-standby configuration, an active service node provides the L2 service while the standby service nodes drop all data messages that they receive. Failover between the active and standby service nodes is handled by the L2 service nodes with no involvement of the L3 gateway device in some embodiments.

The gateway device, in some embodiments, sends heartbeat signals between the two interfaces connected to the L2 service nodes in order to detect failure of the L2 service (e.g., a failure of all the service nodes). In some embodiments, the heartbeat signals are unidirectional heartbeat signals (e.g., a unidirectional bidirectional-forwarding-detection (BFD) session) sent from each interface to the other. The heartbeat signals, in some embodiments, use the IP address of the destination interface as the destination IP address, but use a broadcast MAC address in order to reach the current active L2 service node in the case of a failover (i.e., an active service node failing and a standby service node becoming the new active service node).

Additional embodiments utilize the unidirectional broadcast heartbeat signals to decrease the time between a failover and data messages being forwarded to the new active service node as well as detect a failure of the service node cluster. In embodiments with an L2 bump-in-the-wire service between any two interfaces (e.g., between interfaces of two devices, or between two interfaces of a same device) an architecture using different L2 switches between each interface and the service node cluster is used in conjunction with the unidirectional broadcast heartbeat signals to reduce the time to redirect data messages to the new active service node.

In some embodiments, the switches connecting the interfaces to the service node cluster associate MAC addresses with particular ports of the switch based on incoming data messages. For example, a data message received at the switch on a first port with a source MAC address “MAC1” (e.g., a 48-bit MAC address of the first interface) will cause the switch to associate the first port with the MAC address MAC1 and future data messages with destination address MAC1 will be sent out of the switch from the first port. By sending the heartbeat data messages to the other interface with shorter time intervals between heartbeats than a timeout of a MAC address association (i.e., the time interval before an association between a MAC address and a port is removed) the ports of the switches attached to the active service node can be associated with the correct MAC addresses for the two interfaces more quickly. As a standby node becomes an active node, the broadcast heartbeat data messages will be received and processed by the newly-active service node and the switches will associate the ports connected to the newly-active service node with the appropriate MAC addresses of the two interfaces.

The preceding Summary is intended to serve as a brief introduction to some embodiments of the invention. It is not meant to be an introduction or overview of all inventive subject matter disclosed in this document. The Detailed Description that follows and the Drawings that are referred to in the Detailed Description will further describe the embodiments described in the Summary as well as other embodiments. Accordingly, to understand all the embodiments described by this document, a full review of the Summary, Detailed Description, and the Drawings is needed. Moreover, the claimed subject matters are not to be limited by the illustrative details in the Summary, Detailed Description, and the Drawings, but rather are to be defined by the appended claims, because the claimed subject matters can be embodied in other specific forms without departing from the spirit of the subject matters.

BRIEF DESCRIPTION OF THE DRAWINGS

The novel features of the invention are set forth in the appended claims. However, for purposes of explanation, several embodiments of the invention are set forth in the following figures.

FIG. 1 conceptually illustrates a system in which some on the embodiments of the invention are performed.

FIG. 2 conceptually illustrates a process to establish two connections from a device to a layer 2 bump-in-the-wire service node for the service node to provide a service to data messages.

FIG. 3 conceptually illustrates an embodiment in which an L2 service is provided between two devices by a cluster of service nodes.

FIG. 4 conceptually illustrates a process for detecting failure using the heartbeat signals.

FIG. 5 conceptually illustrates a process performed by a service node in some embodiments.

FIG. 6 conceptually illustrates a process performed by the switches, in some embodiments, to facilitate failover without the device, or devices, that send data messages to the service node cluster being aware of a service node cluster failover operation.

FIGS. 7A-B conceptually illustrate the flow of data messages in a single device embodiment for learning MAC addresses.

FIG. 8 conceptually illustrates the processing of a data message requiring a service provided by the service node cluster after the switches have learned MAC address/interface associations from the data messages depicted in FIGS. 7A-B or in other ways, such as by using an address resolution protocol (ARP) operation.

FIGS. 9A-B conceptually illustrate the path of a data message after a failover, before and after a subsequent heartbeat message is sent from an interface of a device.

FIGS. 10A-B conceptually illustrate an embodiment in which the heartbeat data messages are used to detect failure of a service node cluster as discussed in relation to FIG. 4.

FIG. 11 illustrates an embodiment including gateway devices in an active-standby configuration at a border between two networks.

FIG. 12 conceptually illustrates an electronic system with which some embodiments of the invention are implemented.

DETAILED DESCRIPTION

In the following description, numerous details are set forth for the purpose of explanation. However, one of ordinary skill in the art will realize that the invention may be practiced without the use of these specific details. In other instances, well-known structures and devices are shown in block diagram form in order not to obscure the description of the invention with unnecessary detail.

Some embodiments provide a method for providing a layer 2 (L2) bump-in-the-wire service at a gateway device (e.g., a layer 3 (L3) gateway device) at the edge of a logical network. The method, in some embodiments, establishes a connection from a first interface of the gateway device to a service node that provides the L2 service. The method also establishes a connection from a second interface of the gateway device to the L2 service node. The method then sends data messages received by the gateway device that require the L2 service to the service node using the first interface. In some embodiments, north-to-south traffic (i.e., from the external network to the logical network) is sent to the service node using the first interface while the south-to-north traffic is sent to the service node using the second interface.

As used in this document, the term data packet, packet, data message, or message refers to a collection of bits in a particular format sent across a network. It should be understood that the term data packet, packet, data message, or message may be used herein to refer to various formatted collections of bits that may be sent across a network, such as Ethernet frames, IP packets, TCP segments, UDP datagrams, etc. While the examples below refer to data packets, packets, data messages, or messages, it should be understood that the invention should not be limited to any specific format or type of data message. Also, as used in this document, references to L2, L3, L4, and L7 layers (or layer 2, layer 3, layer 4, layer 7) are references to the second data link layer, the third network layer, the fourth transport layer, and the seventh application layer of the OSI (Open System Interconnection) layer model, respectively.

FIG. 1 conceptually illustrates a system in which some on the embodiments of the invention are performed. FIG. 1 depicts a gateway device 101 that serves as the gateway between a network 110 (e.g., an untrusted network) and a set of tenant networks 120 (e.g., a set of trusted networks that are logical networks in some embodiments). In some embodiments, the gateway device implements a tier 0 (T0) logical router that is shared by multiple tenant networks, each of which connect to the T0 logical router through a unique interface (e.g. logical interface) using a tenant (or tier 1 (T1)) logical router. The gateway device 101 also includes a set of interfaces 130 used to connect to a service node 102 that provides a layer 2 (L2) bump-in-the-wire service (e.g., a firewall, load balancing, network address translation (NAT), or virtual private network (VPN) service) through switches 103.

In some embodiments, gateway device 101 allows for per-tenant policies to be applied by the service node 102 by appending a context (e.g., encapsulation or other marking) to a data message sent to service node 102 with a tenant identifier (e.g., a virtual local area network (VLAN) tag that is associated with a particular tenant's policies). In FIG. 1, service node 102 is shown with a set of three logical interfaces, labeled 1-3 (corresponding to tenants 1-3), each connected to one interface of the two switches 103 (e.g., using VLAN trunking). The logical interfaces, in some embodiments, correspond to a single physical interface of the service node 102. Service node 102, in some embodiments, represents a cluster of service nodes that provide the L2 service. In some embodiments utilizing a cluster of service nodes, the service nodes are configured in an active-standby configuration with one service node performing the L2 service with the additional service nodes in the cluster acting as standby service nodes in case the active service node fails.

FIG. 1 also depicts a datapath for data messages requiring the L2 service (depicted as the dotted line between two interfaces of gateway device 101). The datapath ignores the datapath outside of the gateway device, as the data message may be received from, and destined for, any of the networks 110 or 120A-C. Gateway device 101 is depicted as a gateway device, but one of ordinary skill in the art would understand that the device, in some embodiments, is at a different point in the network that requires an L2 bump-in-the-wire service.

Gateway device 101, in some embodiments, is a host computing machine that executes an edge node program. In some embodiments, the edge node program includes at least one managed forwarding element (e.g. a managed routing element, managed switching element, or both), that implements a set of logical forwarding elements of a set of logical networks for a set of tenants. Further details relating to implementing logical networks using gateway devices (e.g., edge nodes) are found in U.S. Pat. No. 9,787,605 which is hereby incorporated by reference. Further details of the elements of FIG. 1 are described below in the discussion of FIG. 2.

FIG. 2 conceptually illustrates a process 200 to establish two connections from a device (e.g., gateway device 101) to a layer 2 (L2) bump-in-the-wire service node for the service node to provide a service to data messages. In some embodiments, process 200 is performed by the device (e.g., gateway device 101). Process 200 begins by establishing (at 210) a connection to the L2 service node from a first interface 130 of the device. The first interface has a first internet protocol (IP) address which, in some embodiments, is a private IP address that is not used by external networks. In some embodiments, the connection from the first interface is made through a first layer 2 switch (e.g., switch 103A). A layer 2 switch, in some embodiments, learns associations between ports (e.g., interface 130) of the switch and media access control (MAC) addresses of the devices connected to each port from a source MAC address field in the header of the data messages received at the port. In some embodiments, the first switch is a logical switch that is implemented by a physical switch (e.g. a virtual switch or a hardware switch).

The process continues by establishing (at 220) a second connection to the L2 service node from a second interface of the device. The second interface has a second, internet protocol (IP) address different from the first interface which, in some embodiments, is a private IP address that is not used by external networks. In some embodiments, the connection from the second interface is made through a second layer 2 switch. The second layer 2 switch also learns MAC address/port pairings from received data messages in some embodiments. The second switch, in some embodiments, is a logical switch that is implemented by any of a virtual switch or a hardware switch.

Once connections are established from the device, the process receives (at 230) a data message from another device (e.g., a physical router, or a T1 logical router for a specific tenant). The data message, in some embodiments, is a data message exchanged between an external network and a tenant logical network for which the device serves as a gateway device. In some embodiments, the data message is a data message exchanged between an external network and a device in a datacenter for which the device acts as a gateway device. The data message, in some embodiments, is directed from a device in a tenant logical network to another device in a same datacenter or network for which the device acts as a gateway device (e.g., in a same tenant's logical network or a different tenant's logical network). The datacenter, in some embodiments, implements a set of logical networks for a set of tenants. In some embodiments, the data message is received on a third interface of the device. The third interface, in some embodiments, has an IP address that is advertised to external networks by the device.

After receiving the data message, the process determines (at 240) whether the data message requires the L2 bump-in-the-wire service. In some embodiments, the determination is based on a value in a set of header fields of the received data message. The value that the determination is based on may be any combination of a source or destination IP or MAC address, a protocol, and a port number. In some embodiments, a set of header fields are associated specifically with the L2 service (e.g., a network address translation (NAT) service or load balancing (LB) service may be addressable by a particular set of IP addresses, or may be associated with an IP subnet for which they provide the service). The determination, in some embodiments, is made using a routing entry (e.g., a policy-based routing entry) that indicates a certain IP address or range of IP addresses should be forwarded to the MAC of the second interface from the first interface. The range of IP addresses, in some embodiments, is associated with a network for which the L2 service is required. In some embodiments, the policy-based routing entry identifies values in a combination of fields used to determine that a received data message should be forwarded to the MAC of the second interface from the first interface. The fields that may be used to specify data messages that should be forwarded to the MAC of the second interface from the first interface, in some embodiments, include a source IP address, destination IP address, source MAC address, destination MAC address, source port, destination port, and protocol.

The determination (at 240) whether the data message requires the L2 bump-in-the-wire service, in some embodiments, also takes into account the logical network from which the data message was received. In some embodiments, each tenant logical network implements a tier 1 logical router that connects to a tier 0 logical router executing on a gateway device through a different logical interface. For data messages received on a particular logical interface, some embodiments, apply logical-interface-specific (e.g., tenant-specific) policies to determine (at 240) whether the data message requires the service. The tenant, in some embodiments, defines at least two “zones” that include different devices or interfaces and requires sets of services (e.g., services provided by a service node) for data messages between each pair of zones.

If the process determines (at 240) that the data message does not require the L2 service, the process (at 250) processes the data message and forwards it towards its destination and the process ends. In some embodiments, the data message processing is logical processing performed by a software forwarding element implementing a logical forwarding element or elements (e.g., a logical router, a logical switch, or both).

If the process determines (at 240) that the data message does require the L2 service, the process forwards (at 260) the data message out one of the interfaces connected to the L2 service node to be received at the other interface connected to the L2 service node. In some embodiments, north-south traffic coming from an external network into a logical network for which the device is a gateway device is sent to the service node from the first interface to be received at the second interface while south-north traffic from a logical network to the external network is sent to the service node from the second interface to be received by the first interface.

In some embodiments, forwarding (at 260) the data message includes an encapsulation or other marking operation to identify a particular tenant. For example, referring to FIG. 1, a data message received from logical interface ‘1’ of gateway device 101 that requires the service provided by service node 102, is encapsulated so that it will be received at logical interface ‘1’ of service node 102. Based on the encapsulation, service node 102 applies policies specific to tenant 1. Data messages sent between interfaces use the MAC addresses associated with the destination interface of the device which remains unchanged by the processing performed by the L2 service node.

After forwarding (at 260) the data message out of one interface connected to the L2 service node, the process receives (at 270) the data message at the other interface. In some embodiments, the received data message includes an encapsulation or marking associated with a specific tenant. The process then processes (at 250) the received data message and forwards the data message towards its destination. In some embodiments, multiple L2 bump-in-the-wire services are independently provided in a similar fashion.

FIG. 3 conceptually illustrates an embodiment in which an L2 service is provided between two devices 301 by a service node in a cluster of service nodes 305. Device 301A is depicted as including router 310 and switch 303A which, in some embodiments, are software executing on device 301A. Router 310 and switch 303A, in some embodiments, implement logical forwarding elements. In some embodiments, device 301A is a gateway device connecting an internal network to an external network. The internal network is a physical network implementing a logical network in some embodiments, with device 301A implementing the logical forwarding elements using router 310 and switch 303A.

Connections to the service nodes 302, in the depicted embodiment, are made through layer 2 switches 303. The different devices 301 connect to the cluster of service nodes 302 through different switches 303. The service nodes 302 are depicted as a cluster of service nodes 305 in an active-standby configuration that each connect to the same pair of switches. In some embodiments of an active-standby configuration, an active service node provides the L2 service while the standby service nodes drop all data messages that they receive. Failover between the active and standby service nodes is handled by the L2 service nodes with no involvement of devices 301 in some embodiments.

Devices 301, in some embodiments, send heartbeat signals between the two interfaces connected to the L2 service nodes in order to detect failure of the L2 service (e.g., a failure of all the service nodes). In some embodiments, the heartbeat signals are unidirectional heartbeat signals (e.g., a unidirectional bidirectional-forwarding-detection (BFD) session) sent from each interface to the other. The heartbeat signals, in some embodiments, use the IP address of the destination interface as the destination IP address, but use a broadcast MAC address in order to reach the current active L2 service node in the case of a failover (i.e., an active service node failing and a standby service node becoming the new active service node).

FIG. 4 conceptually illustrates a process 400 for detecting failure using the heartbeat signals. Process 400, in some embodiments, is executed by at least one device 301 and, in some embodiments, is executed by each device 301. Process 400 begins (at 410) by establishing a unidirectional session between the interface (e.g., 330A) that connects to the cluster of service nodes and the interface (e.g. 330B) of the device attached to the other switch connected to the cluster of service nodes.

The process subsequently sends (at 420) a heartbeat data message to the second device. In some embodiments, device 301A directs the data message to the IP address of the interface of the second device (e.g., 330B) using a broadcast MAC address. The heartbeat data message has a source MAC address of the interface of the first device that is learned by the switches connected to the service nodes and associated by the switches with the interfaces on which the heartbeat data message is received by the switch.

The process receives (at 430) a heartbeat data message from the second device. In some embodiments, the heartbeat messages are sent and received at intervals that are shorter than a timeout of a learned MAC address/interface pairing in the switches (e.g., 303). In some embodiments, the received message is sent from the second device directed to the IP address of the first interface using a broadcast MAC address.

At 440, the process determines that the service nodes (e.g., 302) have failed. In some embodiments, the determination is made based on a time elapsed since a last heartbeat message was received. The time elapsed to determine failure of the service nodes (e.g., 302), in some embodiments, is based on the time between heartbeat signals, e.g., 5 heartbeat signals, or on a failover time for the service nodes in a service node cluster.

Upon determining (at 440) that a service node cluster has failed, the process performs (at 450) a default operation for subsequent packets until the service is restored. In some embodiments, the default operation is forwarding all data messages to their destination without sending them to be provided the L2 service. In other embodiments, the default operation is dropping all data messages that require the L2 service until the L2 service is restored. In some embodiments, the device continues to send heartbeat data messages and determines that the service has been restored when a heartbeat is received from the other device or interface.

Additional embodiments utilize the unidirectional broadcast heartbeat signals to decrease the time between a failover and data messages being forwarded to the new active service node as well as detect a failure of the service node cluster. In embodiments with an L2 bump-in-the-wire service between any two interfaces (e.g., between interfaces of two devices, or between two interfaces of a same device) an architecture using different L2 switches between each interface and the service node cluster is used in conjunction with the unidirectional broadcast heartbeat signals to reduce the time to redirect data messages to the new active service node. FIGS. 5 and 6 conceptually illustrate processes performed by a service node and a switch, respectively, in some such embodiments.

FIG. 5 conceptually illustrates a process 500 performed by a service node in some embodiments. Process 500 begins by receiving (at 510) data messages sent from one of two interfaces in communication with each other through the service node cluster including the service node performing 500. When the service node is a standby service node, the data messages are heartbeat data messages that are addressed to an IP address associated with either one of the two interfaces of the device or devices in communication with the service node and a broadcast MAC address. In some embodiments, the heartbeat data messages are received from one of two interfaces connected to the service node cluster through a pair of switches as in FIG. 3. When the service node is an active service node, the data messages include data messages requiring the service provided by the service node cluster. In some embodiments, a data message is received with a context (e.g., an encapsulation or other marking) that is understood by the service node to identify a particular set of policies to apply to the data message. The context, in some embodiments, identifies a set of policies that are for a specific tenant.

The process then processes (at 520) the data messages at the service node. When the service node is designated as a standby service node, processing a data message, in some embodiments, comprises dropping the data message. Dropping data messages at the standby service node avoids redundant processing and, in embodiments providing a stateful service, misprocessing based on a lack of current state information. When the service node is designated, or acting, as an active service node, processing a heartbeat data message includes forwarding the data message to the destination interface without alteration.

Processing the data message at an active node, in some embodiments, includes applying tenant-specific policies to the data message. The tenant-specific policies are identified based on a context appended to the data message by the device (e.g., a gateway device) that directs the data message to the service node. Processing a data message requiring the service at an active service node includes providing the service and forwarding the data message to the destination IP address without altering the source and destination MAC addresses of the received data message.

A service node performing process 500, in some embodiments, acts as a standby service node at some times and, if an active service node fails, acts (or is designated) as the active service node at other times. The failover process between service nodes, in some embodiments, is independent of the devices sending the heartbeat data messages. In some embodiments, the service node cluster has a control or management computer or cluster that determines and designates the active service node. The control/management computer, in some embodiments, maintains its own failure detection protocol (e.g., BFD) to detect the health of the service nodes in a service node cluster and initiate a failover process.

FIG. 6 conceptually illustrates a process 600 performed by the switches, in some embodiments, to facilitate failover without the device, or devices, that send data messages to the service node cluster being aware of a service node cluster failover operation. The process begins by receiving (at 610) a data message from one of the interfaces of a device sending data messages to the service node cluster through the switch. The data message, in some embodiments, is a heartbeat data message sent from one interface to another through the switches and service node cluster. In some embodiments, the heartbeat data message uses a broadcast MAC address (i.e., FF:FF:FF:FF:FF:FF) as a destination MAC address. The heartbeat data message also includes a MAC address of the interface from which the data message was sent as a source MAC address.

The process then learns (at 620) a pairing between a port (e.g. interface) at which the data message was received and a MAC address used as a source MAC address of the received data message. The learning, in some embodiments, is accomplished through a table or other data structure that stores associations between MAC addresses and ports of the switch. The learned association is used to process subsequent data messages addressed to the MAC address by forwarding the subsequent data message to the destination from the associated port.

The process then forwards (at 630) the received heartbeat data message out all the ports other than the port on which it was received. The broadcast heartbeat data message is then received at the service nodes of the service node cluster as described in relation to operation 510 of FIG. 5 for a particular service node. As described above in relation to FIG. 5, only the active service node forwards the received heartbeat data message to the second interface through the second switch. The second switch receives the forwarded data message and associates the port connected to the active service node with the source MAC address of the heartbeat data message (i.e., the MAC address of the first interface) and forwards the heartbeat data message out all ports except for the port at which it was received as will be described in relation to operations 640 and 650 for the first switch performing process 600.

The process then receives (at 640) a heartbeat data message from the second interface through an active service node. The heartbeat data message is received from the active service node, but not the standby service nodes as only the active service node allows data messages to be forwarded towards the destination. The heartbeat data message, in some embodiments, is received by the first switch after a second switch receives the data message from the second interface. In some embodiments, the second interface sends the heartbeat data message using the second interface's MAC address as a source MAC address and a broadcast MAC address as the destination address. Based on the broadcast MAC address, the second switch floods the data message to all the service nodes as described for the first switch in operation 630.

The process then learns (at 650) a pairing between a port at which the data message was received and a MAC address used as a source MAC address of the received data message (i.e., the MAC address of the second interface). The port that is associated with the second interface's MAC address is the port connected to the active service node, because only the active service node forwards the data message to the first switch. The learned address/port pairing is stored, in some embodiments, in the same table or other data structure that stores the association between the MAC address of the first interface and the port at which the first heartbeat data message was received. The learned association is used to process subsequent data messages addressed to the MAC address of the second interface by forwarding the subsequent data message to the destination from the associated port. The switch has now learned the ports associated with the MAC addresses of the first and second interfaces and can use those learned associations to process subsequent data messages.

The process receives (at 660) a data message that requires the service provided by the service node cluster. The data message is received at the port of the switch that connects to the first interface, in some embodiments. The data message, in some embodiments, has a destination address that is the MAC address of the second interface.

The process then forwards (at 670) the data message that requires the service to the active service node. The process does not need to perform an address resolution protocol (ARP) operation to identify the port because the MAC address/port pairing was previously learned as part of learning operation 650. Additionally, if an active service node fails, the heartbeat data messages sent subsequent to the service node failover process will be forwarded by the new active service node and the MAC address/port pairings for the first and second interface MAC addresses will be remapped to the ports connected to the new active service node. One of ordinary skill in the art will understand that operations relating to heartbeat data messages are independent of operations related to data message processing for data messages received from a network connected to the device and may be omitted in some embodiments.

FIGS. 7A-B conceptually illustrates the flow of data messages in a single device embodiment 700 for learning MAC addresses. As for device 101 in FIG. 1, Device 701 serves as a gateway device between networks 710 and 720. Data message ‘1’ represents a heartbeat data message sent from an interface 730A to an interface 730C (e.g., a port) of a switch 703A. Data message ‘1’ is a heartbeat data message that has (1) a source IP address (Src IP) that is the IP address of interface 730A, (2) a source MAC address (Src MAC) that is the MAC address of interface 730A (e.g., MAC 1), (3) a destination IP address (Dst IP) that is the IP address of interface 730B, and (4) a destination MAC address that is a broadcast MAC address (e.g., FF:FF:FF:FF:FF:FF). As described above, switch 703A receives data message ‘1’ at interface 730C and learns an association between MAC 1 and interface 730C, and forwards the data message as data messages ‘2’ to all other interfaces 730D-F of the switch. Data message ‘2’ is received by service nodes 702A-C and is forwarded to interface 730G of switch 703B only by the active service node 702A as data message ‘3’ because standby service nodes 702B-C drop data messages received based on their designation as standby service nodes. Data messages ‘2’ and ‘3’ maintain the same source and destination addresses as data message ‘1’ in some embodiments.

Switch 703B learns an association between MAC 1 and interface 730G as discussed above in relation to FIG. 6. Data message ‘3’ is then forwarded to all other interfaces of switch 703B (i.e., interfaces 730H-J) as data message ‘4.’ Device 701 receives the heartbeat data message and determines that the service cluster has not failed. Standby service nodes 702B-C drop the data message. At this stage, an association between the MAC address of interface 730A and interfaces 730C and 730G is learned by switches 703A and 703B respectively.

A similar heartbeat data message sent from the interface 730B causes an association between a MAC address of interface 730B (e.g., MAC 2) with interfaces 730J and 730C to be learned by switches 703B and 703A respectively. Data message ‘5’ represents a heartbeat data message sent from an interface 730B to an interface 730J (e.g., a port) of a switch 703B. Data message ‘5’ is a heartbeat data message that has (1) a Src IP that is the IP address of interface 730B, (2) a Src MAC that is the MAC address of interface 730B (e.g., MAC 2), (3) a Dst IP that is the IP address of interface 730A, and (4) a destination MAC address that is a broadcast MAC address (e.g., FF:FF:FF:FF:FF:FF). As described above, switch 703B receives data message ‘5’ at interface 730J and learns an association between MAC 2 and interface 730J and forwards the data message as data messages ‘6’ to all other interfaces 730G-I of the switch. Data message ‘6’ is received by service nodes 702A-C and is forwarded to interface 730D of switch 703A only by the active service node 702A as data message ‘7’ because standby service nodes 702B-C drop data messages received based on their designation as standby service nodes. Data messages ‘6’ and ‘7’ maintain the same source and destination addresses as data message ‘5’ in some embodiments.

Switch 703A learns an association between MAC 2 and interface 730D as discussed above in relation to FIG. 6. Data message ‘7’ is then forwarded to all other interfaces of switch 703A (i.e., interfaces 730C, E, and F) as data message ‘8.’ Device 701 receives the heartbeat data message and determines that the service cluster has not failed. Standby service nodes 702B-C drop the data message. At this stage, an association between the MAC address of interface 730B and interfaces 730D and 730J is learned by switches 703A and 703B respectively.

FIGS. 8 conceptually illustrates the processing of a data message requiring a service provided by the service node cluster 705 after the switches have learned MAC address/interface associations from the data messages depicted in FIG. 7 or in other ways, such as by using an address resolution protocol (ARP) operation. Data message ‘9’ represents a data message requiring the service provided by service node cluster 705. Data message ‘9’ has (1) a Src IP that is the IP address of interface 730A, (2) a Src MAC that is the MAC address of interface 730A (e.g., MAC 1), (3) a Dst IP that is the IP address of interface 730B, and (4) a destination MAC address that is a MAC address of interface 730B (e.g., MAC 2). Data message ‘9’ is sent from interface 730A to interface 730C of switch 703A.

Upon receiving the data message, switch 703A consults the table or other data structure storing the MAC/interface associations to determine that MAC 2 (i.e., the destination MAC address) is associated with interface 730D and sends, as data message ‘10,’ the data message to service node 702A using interface 730D. Service node 702A processes the data message, including providing the service provided by the service node cluster 705 and sends the processed data message as data message ‘11’ to interface 730G of switch 703B. Upon receiving data message ‘11,’ switch 703B consults the table or other data structure storing the MAC/interface associations to determine that MAC 2 (i.e., the destination MAC address) is associated with interface 730J and sends, as data message ‘12,’ the data message to interface 730B using interface 730J. Return data messages are handled similarly.

FIGS. 9A-B conceptually illustrate the path of a data message after a failover, before and after a subsequent heartbeat message is sent from an interface 730 of device 701. FIG. 9A illustrates the failure of service node 702A and service node 702B being designated as the new active service node. After the failure of service node 702A, data message ‘13’ is sent from interface 730A with the same Src IP, Src MAC, Dst IP, and Dst MAC as data message ‘9.’ Switch 703A sends data message ‘14’ to service node 702A based on the association previously learned between MAC 2 and interface 730D, however, service node 702A has failed and the data message is lost. In a setup without the heartbeat data messages described in FIGS. 7A-B, the data messages in both directions would continue to be dropped (i.e., black-holed) until a timeout of the learned MAC address/interface associations, at which point a new learning operation (e.g. an ARP operation) would be performed indicating that the MAC address should be associated with the interface connected to the new active service node.

If, however, heartbeat data message ‘15’ is sent from interface 730B (using the same combination of Src IP, Src MAC, Dst IP, and Dst MAC as data message ‘5’), switch 703B once again floods the data message as data messages ‘16’ as described in relation to data message ‘6’ and the new active service node 702B receives and forwards the data message to switch 703A (not depicted). This causes switch 703A to update its MAC address/interface table or other data structure to indicate an association between MAC 2 and interface 730E connected to service node 702B. Using this updated association allows subsequently received data message requiring the service provided by service node cluster 705 to follow a path illustrated by data messages ‘17’-‘20’ without any change in the set of Src IP, Src MAC, Dst IP, and Dst MAC at the device 701 for data messages going in the same direction. Heartbeat data messages are sent at time intervals that are shorter than a timeout interval for learned MAC address/interface associations so that in the case of service node failover, the service is restored based on the shorter heartbeat data message interval rather than the longer timeout interval for learned MAC address/interface associations.

FIGS. 10A-B conceptually illustrates an embodiment in which the heartbeat data messages are used to detect failure of a service node cluster as discussed in relation to FIG. 4. FIG. 10A illustrates the same elements as in FIG. 3, however in FIG. 10A two of the three service nodes 302 have failed (i.e., 302A and 302C). A first heartbeat data message, data message ‘1,’ is sent from interface 330A to interface 330B. Data message ‘1’ traverses switch 303A, service node 302B and switch 303B before arriving at interface 330B. a heartbeat data message, data message ‘2,’ is sent from interface 330B to interface 330A traversing switch 303B, service node 302B and switch 303A before being received by device 301A at interface 330A. As described in relation to FIG. 7, data messages ‘3’ and ‘4’ represent the rest of the datapath for heartbeat data messages. These heartbeat data messages are used to determine that the service node cluster 305 is still functioning (e.g., still providing the service).

FIG. 10B illustrates a heartbeat data message being unable to reach a destination interface after the failure of all the service nodes 302 in service node cluster 305. Data messages ‘5’ and ‘6’ represent heartbeat data messages that are sent by interface 330A and 330B respectively. Data messages ‘5’ and ‘6’ arrive at switches 303A and 303B respectively, are forwarded to all the service nodes 302A-C, as data messages ‘7’ and ‘8’ respectively, based on the broadcast destination MAC address, but are not forwarded towards the other interface because the service nodes have failed. In some embodiments, the failure of the service nodes is based on a connection failure between the switches and the service node or between the interface of the devices 301 and a switch 303. One of ordinary skill in the art would understand that the same service node cluster failure detection would function in the same way between two interfaces of a single device. In embodiments in which the two interfaces belong to a same device, failure detection may also be based on the fact that data messages the device sends out one interface are not received at the other interface which may enable faster failure detection than a system that is not aware of when heartbeat data messages are sent by the other device.

As discussed above in relation to FIG. 4, after a certain time interval (e.g., representing a certain number of missed heartbeat data messages) during which a heartbeat data message has not been received, devices 301 determine that the service node cluster 305 has failed and perform a default operation for data messages requiring the service provided by the service node cluster 305. In some embodiments, the default operation is to forward the data messages without providing the service (e.g., a fail-open condition) while in other embodiments, the default operation is to drop the data messages requiring the service (e.g., a fail-closed condition) until the service is restored. A fail-open condition may be more appropriate for services such as load balancing where security is not an issue while fail-closed may be more appropriate for a firewall operation relating to security and a network address translation (NAT) service which generally requires state information that is maintained by the service node providing the service.

FIG. 11 illustrates an embodiment including gateway device 701A and gateway device 701B that each act at a border between network 710 (e.g., an external network) and network 720 (e.g., an internal/logical network). The elements of FIG. 11 act as the similarly numbered elements of FIG. 7 with the additional designation of one of the devices 701 as the active gateway device (e.g., gateway device 701A). The active gateway device 701A, in some embodiments receives all data messages exchanged between the networks 710 and 720. In some embodiments, the gateway devices also execute centralized aspects of a logical router for a logical network implemented in network 720. In some embodiments using a centralized logical router in the gateway devices, only one gateway device provides the centralized logical router services.

FIG. 12 conceptually illustrates an electronic system 1200 with which some embodiments of the invention are implemented. The electronic system 1200 can be used to execute any of the control, virtualization, or operating system applications described above. The electronic system 1200 may be a computer (e.g., a desktop computer, personal computer, tablet computer, server computer, mainframe, a blade computer etc.), phone, PDA, or any other sort of electronic device. Such an electronic system includes various types of computer readable media and interfaces for various other types of computer readable media. Electronic system 1200 includes a bus 1205, processing unit(s) 1210, a system memory 1225, a read-only memory (ROM) 1230, a permanent storage device 1235, input devices 1240, and output devices 1245.

The bus 1205 collectively represents all system, peripheral, and chipset buses that communicatively connect the numerous internal devices of the electronic system 1200. For instance, the bus 1205 communicatively connects the processing unit(s) 1210 with the read-only memory 1230, the system memory 1225, and the permanent storage device 1235.

From these various memory units, the processing unit(s) 1210 retrieve instructions to execute and data to process in order to execute the processes of the invention. The processing unit(s) may be a single processor or a multi-core processor in different embodiments.

The read-only-memory 1230 stores static data and instructions that are needed by the processing unit(s) 1210 and other modules of the electronic system. The permanent storage device 1235, on the other hand, is a read-and-write memory device. This device is a non-volatile memory unit that stores instructions and data even when the electronic system 1200 is off. Some embodiments of the invention use a mass-storage device (such as a magnetic or optical disk and its corresponding disk drive) as the permanent storage device 1235.

Other embodiments use a removable storage device (such as a floppy disk, flash drive, etc.) as the permanent storage device. Like the permanent storage device 1235, the system memory 1225 is a read-and-write memory device. However, unlike storage device 1235, the system memory is a volatile read-and-write memory, such as random access memory. The system memory stores some of the instructions and data that the processor needs at runtime. In some embodiments, the invention's processes are stored in the system memory 1225, the permanent storage device 1235, and/or the read-only memory 1230. From these various memory units, the processing unit(s) 1210 retrieve instructions to execute and data to process in order to execute the processes of some embodiments.

The bus 1205 also connects to the input and output devices 1240 and 1245. The input devices enable the user to communicate information and select commands to the electronic system. The input devices 1240 include alphanumeric keyboards and pointing devices (also called “cursor control devices”). The output devices 1245 display images generated by the electronic system. The output devices include printers and display devices, such as cathode ray tubes (CRT) or liquid crystal displays (LCD). Some embodiments include devices such as a touchscreen that function as both input and output devices.

Finally, as shown in FIG. 12, bus 1205 also couples electronic system 1200 to a network 1265 through a network adapter (not shown). In this manner, the computer can be a part of a network of computers (such as a local area network (“LAN”), a wide area network (“WAN”), or an Intranet, or a network of networks, such as the Internet. Any or all components of electronic system 1200 may be used in conjunction with the invention.

Some embodiments include electronic components, such as microprocessors, storage and memory that store computer program instructions in a machine-readable or computer-readable medium (alternatively referred to as computer-readable storage media, machine-readable media, or machine-readable storage media). Some examples of such computer-readable media include RAM, ROM, read-only compact discs (CD-ROM), recordable compact discs (CD-R), rewritable compact discs (CD-RW), read-only digital versatile discs (e.g., DVD-ROM, dual-layer DVD-ROM), a variety of recordable/rewritable DVDs (e.g., DVD-RAM, DVD-RW, DVD+RW, etc.), flash memory (e.g., SD cards, mini-SD cards, micro-SD cards, etc.), magnetic and/or solid state hard drives, read-only and recordable Blu-Ray® discs, ultra density optical discs, any other optical or magnetic media, and floppy disks. The computer-readable media may store a computer program that is executable by at least one processing unit and includes sets of instructions for performing various operations. Examples of computer programs or computer code include machine code, such as is produced by a compiler, and files including higher-level code that are executed by a computer, an electronic component, or a microprocessor using an interpreter.

While the above discussion primarily refers to microprocessor or multi-core processors that execute software, some embodiments are performed by one or more integrated circuits, such as application specific integrated circuits (ASICs) or field programmable gate arrays (FPGAs). In some embodiments, such integrated circuits execute instructions that are stored on the circuit itself.

As used in this specification, the terms “computer”, “server”, “processor”, and “memory” all refer to electronic or other technological devices. These terms exclude people or groups of people. For the purposes of the specification, the terms display or displaying means displaying on an electronic device. As used in this specification, the terms “computer readable medium,” “computer readable media,” and “machine readable medium” are entirely restricted to tangible, physical objects that store information in a form that is readable by a computer. These terms exclude any wireless signals, wired download signals, and any other ephemeral signals.

This specification refers throughout to computational and network environments that include virtual machines (VMs). However, virtual machines are merely one example of data compute nodes (DCNs) or data compute end nodes, also referred to as addressable nodes. DCNs may include non-virtualized physical hosts, virtual machines, containers that run on top of a host operating system without the need for a hypervisor or separate operating system, and hypervisor kernel network interface modules.

VMs, in some embodiments, operate with their own guest operating systems on a host machine using resources of the host machine virtualized by virtualization software (e.g., a hypervisor, virtual machine monitor, etc.). The tenant (i.e., the owner of the VM) can choose which applications to operate on top of the guest operating system. Some containers, on the other hand, are constructs that run on top of a host operating system without the need for a hypervisor or separate guest operating system. In some embodiments, the host operating system uses name spaces to isolate the containers from each other and therefore provides operating-system level segregation of the different groups of applications that operate within different containers. This segregation is akin to the VM segregation that is offered in hypervisor-virtualized environments that virtualize system hardware, and thus can be viewed as a form of virtualization that isolates different groups of applications that operate in different containers. Such containers are more lightweight than VMs.

Hypervisor kernel network interface modules, in some embodiments, is a non-VM DCN that includes a network stack with a hypervisor kernel network interface and receive/transmit threads. One example of a hypervisor kernel network interface module is the vmknic module that is part of the ESXi™ hypervisor of VMware, Inc.

It should be understood that while the specification refers to VMs, the examples given could be any type of DCNs, including physical hosts, VMs, non-VM containers, and hypervisor kernel network interface modules. In fact, the example networks could include combinations of different types of DCNs in some embodiments.

While the invention has been described with reference to numerous specific details, one of ordinary skill in the art will recognize that the invention can be embodied in other specific forms without departing from the spirit of the invention. In addition, a number of the figures (including FIGS. 2 and 4-6) conceptually illustrate processes. The specific operations of these processes may not be performed in the exact order shown and described. The specific operations may not be performed in one continuous series of operations, and different specific operations may be performed in different embodiments. Furthermore, the process could be implemented using several sub-processes, or as part of a larger macro process. Thus, one of ordinary skill in the art would understand that the invention is not to be limited by the foregoing illustrative details, but rather is to be defined by the appended claims. 

1-19. (canceled)
 20. A method to perform a service at a gateway of a network, the method comprising: at the gateway: receiving a data message that requires a particular service provided by a service node that connects to the gateway through first and second interfaces of the gateway; sending the data message to the service node from the first interface of the gateway; and receiving the data message from the service node through the second interface after the service node performs the particular service on the data message.
 21. The method of claim 20, wherein the particular service does not change layer 2 (L2) addresses associated with the data message, and sending the data message comprises sending the data message using the media access control (MAC) address of the second interface.
 22. The method of claim 21, wherein the first interface has a media access control (MAC) address and internet protocol (IP) address that is different from the MAC and IP addresses of the second interface.
 23. The method of claim 21, wherein the service node sends the data message to the second interface using a destination MAC address that is the MAC address of the second interface.
 24. The method of claim 20, wherein gateway connects to the service node through first and second switches with the first interface associated with the first switch and the second interface associated with the second switch.
 25. The method of claim 20, wherein the gateway is a gateway deployed at a boundary of a logical network and an external network, the logical network defined over a shared physical network.
 26. The method of claim 20, wherein the service node is a first service node that is one of a plurality of service nodes configured as a cluster of service nodes to provide the particular service.
 27. The method of claim 26, wherein the cluster of service nodes is configured in an active-standby configuration in which the first service node is an active service node.
 28. The method of claim 27, wherein standby service nodes drop received data messages.
 29. The method of claim 20, wherein the service node comprises one of a virtual machine, an appliance, a data compute node, a container, and a server.
 30. A non-transitory machine readable medium storing a program for execution by a set of processing units to implement a gateway of a network, the program comprising sets of instructions for: receiving a data message that requires a particular service provided by a service node that connects to the gateway through first and second interfaces of the gateway; sending the data message to the service node from the first interface of the gateway; and receiving the data message from the service node through the second interface after the service node performs the particular service on the data message.
 31. The non-transitory machine readable medium of claim 30, wherein the particular service does not change layer 2 (L2) addresses associated with the data message, and sending the data message comprises sending the data message using the media access control (MAC) address of the second interface.
 32. The non-transitory machine readable medium of claim 31, wherein the first interface has a media access control (MAC) address and internet protocol (IP) address that is different from the MAC and IP addresses of the second interface.
 33. The non-transitory machine readable medium of claim 31, wherein the service node sends the data message to the second interface using a destination MAC address that is the MAC address of the second interface.
 34. The non-transitory machine readable medium of claim 30, wherein gateway connects to the service node through first and second switches with the first interface associated with the first switch and the second interface associated with the second switch.
 35. The non-transitory machine readable medium of claim 30, wherein the gateway is a gateway deployed at a boundary of a logical network and an external network, the logical network defined over a shared physical network.
 36. The non-transitory machine readable medium of claim 30, wherein the service node is a first service node that is one of a plurality of service nodes configured as a cluster of service nodes to provide the particular service.
 37. The non-transitory machine readable medium of claim 36, wherein the cluster of service nodes is configured in an active-standby configuration in which the first service node is an active service node.
 38. The non-transitory machine readable medium of claim 37, wherein standby service nodes drop received data messages.
 39. The non-transitory machine readable medium of claim 40, wherein the service node comprises one of a virtual machine, an appliance, a data compute node, a container, and a server. 